import Mock from 'mockjs'

export const userInfo = {
  username: 'aaaa',
  passwod: '123456',
  type: 'dashen',
  header: 'ceshilianjei',
  post: 'zhiwei',
  info: '个人简介',
  company: 'gongsi',
  salary: '12000'
}
const Random = Mock.Random
const userData = Mock.mock({
  id: Random.id(),
  username: Random.string(4, 10),
  passwod: Random.string(4, 10),
  'type|1': ['dashen', 'laoban'],
  header: Random.image(),
  post: 'zhiwei',
  info: Random.cparagraph(),
  company: Random.string(4, 10),
  salary: Random.string('number', 5)
})
const reqUser = {
  data: userData,
  msg: 'success',
  code: 0
}
const iconHeader = []
for (let index = 0; index < 20; index++) {
  let icon = Mock.mock({
    id: Random.increment,
    icon: Random.dataImage('300x300')
  })
  iconHeader.push(icon)
}

const itemUserList = []
for (let listIndex = 0; listIndex < 20; listIndex++) {
  itemUserList.push({
    id: Random.id(),
    username: Random.string(4, 10),
    passwod: Random.string(4, 10),
    'type|1': ['dashen', 'laoban'],
    header: Random.image('150x150'),
    post: 'zhiwei',
    info: Random.cparagraph(),
    company: Random.string(4, 10),
    salary: Random.string('number', 5)
  })
}
const reqItemUserList = {
  data: itemUserList,
  msg: 'success',
  code: 0
}
Mock.mock('/user/register', 'post', reqUser)
Mock.mock('/user/login', 'post', reqUser)
Mock.mock('/user/update', 'post', reqUser)
Mock.mock('/user/headerIcon', 'get', iconHeader)
Mock.mock('/user/reqUser', 'get', reqUser)
Mock.mock('/user/reqUserList', 'get', reqItemUserList)
Mock.setup({
  timeout: 0 - 300
})
